package com.computercourse.manage_media.controller;

import com.computercourse.api.media.MediaFileControllerApi;
import com.computercourse.framework.domain.media.MediaFile;
import com.computercourse.framework.domain.media.request.QueryMediaFileRequest;
import com.computercourse.framework.model.response.QueryResponseResult;
import com.computercourse.framework.model.response.ResponseResult;
import com.computercourse.manage_media.service.MediaFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description
 * @author Feng.Yuan
 * @date 2020/1/30 9:49 下午
 * @return
 */
@RestController
@RequestMapping("/media/file")
public class MediaFileController implements MediaFileControllerApi {

    @Autowired
    private MediaFileService mediaFileService;

    @Override
    @GetMapping("/list/{page}/{size}")
    public QueryResponseResult<MediaFile> findList(@PathVariable("page") int page, @PathVariable("size") int size, QueryMediaFileRequest queryMediaFileRequest) {
        return mediaFileService.findList(page, size, queryMediaFileRequest);
    }

    @Override
    @GetMapping("/process/{fileNameMD5Id}")
   public ResponseResult processFile(@PathVariable String fileNameMD5Id){
        return mediaFileService.startProcessFile(fileNameMD5Id);

    }
}
